﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FILSTARTUPS_MOBILE.Helpers
{
    public class Mobile_Helpers
    {
        public static string Create()
        {
            string key = string.Empty;
            key = Guid.NewGuid().ToString().Substring(0, 20);
            return key;
        }
        public static string truncate(string description, int lenght)
        {
            if (description.Length < lenght)
            {
                return description;
            }
            else
            {
                return description.Substring(0, lenght) + "...";
            }
        }

        // Calculate Age
        public static int CalculateAge(DateTime birthDate)
        {
            DateTime now = DateTime.Today;
            int years = now.Year - birthDate.Year;

            if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day))
                --years;

            return years;
        }
    }
}